<?php

/*
 * Stores event informations
 * 
 * PHP version 5
 * 
 * LICENSE: This open source file is subject for training of the PHP 
 * - jQuery, available at http://localhost/public/index.php
 * 
 * @author Mamoudou Camara <camara.mamoudou@gmail.com>
 * @copyright 2013 Training PHP and jQeury
 * @license http://localhost/public/index.php
 * 
 * 
 */

class Event
{
    /**
     * 
     * The event ID
     * 
     * $var int
     * 
     */
    public $id;
    
    /**
     * 
     * The event title
     * 
     * @var string 
     * 
     */
    public $title;
    
    /**
     * 
     * The event description
     * 
     * @var string
     */
    public $description;
    
    /**
     * 
     * The event start time
     * 
     * @var string 
     */
    public $start;
    
    /**
     * 
     * The event end time
     * 
     * @var string
     */
    public $end;
    
    /**
     * 
     * Accepts an array of event data and store it
     * 
     * @param array $event Association array of event data 
     */
    public function __construct($event) 
    {
        if (is_array($event)) 
        {
            $this->id = $event['event_id'];
            $this->title = $event['event_title'];
            $this->description = $event['event_desc'];
            $this->start = $event['event_start'];
            $this->end = $event['event_end'];                 
        }
        
        else
        {
            throw new Exception('No event data was supplied!!');
        }
    }
}
    
?>
